package com.jlpay.openapi.demo.openmerch.device;

import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import main.java.com.jlpay.open.jlpay.sdk.java.model.openmerch.device.request.DeviceQueryRequest;
import main.java.com.jlpay.open.jlpay.sdk.java.model.openmerch.device.response.DeviceQueryResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author laochangyi
 * @since 2025/8/13
 **/
public class QueryService {

    private static final Logger LOGGER = LoggerFactory.getLogger(QueryService.class);

    public static void main(String[] args) {
        DeviceQueryRequest deviceQueryRequest = buildDeviceQueryRequest();
        DeviceQueryResponse deviceQueryResponse = JlpayOpenApiService.openMerchWithCryptoService()
                .post(deviceQueryRequest, DeviceQueryResponse.class);
        LOGGER.info("终端查询响应:{}", JsonUtils.toString(deviceQueryResponse));
    }

    private static DeviceQueryRequest buildDeviceQueryRequest(){
        DeviceQueryRequest deviceQueryRequest = new DeviceQueryRequest();

        deviceQueryRequest.setMerchNo("84944035812S123");
        //deviceQueryRequest.setDeviceNo("AQR1000030");
        //deviceQueryRequest.setTermNo("AQR1000030");

        return deviceQueryRequest;
    }

}
